#!/usr/bin/php
<?php

$fp = fopen("php://stdin", "r");
while($line = fgets($fp)) {
	$line = str_replace("\n", "", $line);
	if (ereg("([^,]*),([^,]*),([^,]*),([^,]*),(.*)", $line, $reg)) {
		$version = $reg[1];
		$book = $reg[2];
		$chapter = $reg[3];
		$verse = $reg[4];
		$text = $reg[5];

		$bible[$version][$book][$chapter][$verse] = $text;
	}
}
fclose($fp);

echo json_encode($bible);

?>
